
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户权限管理</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.min.css">
    <style>
        body { padding: 20px; background-color: #f8f9fa; }
        .card { border-radius: 10px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
        .table th { background-color: #6c5ce7; color: white; }
        .table tr:hover { background-color: #f1f1f1; }
        .badge { padding: 5px 10px; border-radius: 15px; }
        .btn-primary { background-color: #6c5ce7; border-color: #6c5ce7; }
        .btn-primary:hover { background-color: #5649c0; border-color: #5649c0; }
        .error-msg { color: #dc3545; padding: 10px; text-align: center; }
    </style>
</head>
<body>
    <div class="container">
        <div class="card p-4 mb-4">
            <div class="d-flex justify-content-between align-items-center mb-4">
                <h2 class="mb-0"><i class="fas fa-users-cog me-2"></i>用户权限管理</h2>
                <button class="btn btn-secondary" onclick="history.go(-1)">
                    <i class="fas fa-arrow-left me-2"></i>返回
                </button>
            </div>

            <div class="mb-4">
                <a href="addUser" class="btn btn-primary me-2">
                    <i class="fas fa-user-plus me-2"></i>添加用户
                </a>
                <a href="plsc" class="btn btn-info">
                    <i class="fas fa-tasks me-2"></i>批量操作
                </a>
            </div>

            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>卡号</th>
                            <th>用户名</th>
                            <th>套餐</th>
                            <th>预存金额</th>
                            <th>余额</th>
                            <th>注册时间</th>
                            <th>状态</th>
                            <th>权限</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <c:forEach var="user" items="${pagehelper.list}" varStatus="vs">
                            <tr>
                                <td>${vs.count}</td>
                                <td>${user.card_number}</td>
                                <td>${user.username}</td>
                                <td>${user.planName}</td>
                                <td>${user.prepaid_amount}</td>
                                <td>${user.balance}</td>
                                <td>${user.register_time}</td>
                                <td>
                                    <span class="badge ${user.statusName == '正常' ? 'bg-success' : 'bg-danger'}">
                                        ${user.statusName}
                                    </span>
                                </td>
                                <td>
                                    <span class="badge ${user.role == '管理员' ? 'bg-primary' : 'bg-info'}">
                                        ${user.role}
                                    </span>
                                </td>
                                <td>
                                    <a href="update_user?id=${user.id}" class="btn btn-sm btn-warning">
                                        <i class="fas fa-edit">修改</i>
                                    </a>
                                    <a href="deleteUser?id=${user.id}" class="btn btn-sm btn-danger">
                                        <i class="fas fa-trash-alt">删除</i>
                                    </a>
                                </td>
                            </tr>
                        </c:forEach>
                    </tbody>
                </table>
            </div>

            <div class="error-msg">${msg}</div>
            <%@include file="pagehelper.jsp" %>
        </div>
    </div>
</body>
</html>
